<?php
/**
 * Use:
 * Config::getInstance()->db_host вернет "localhost" =)
 *
 * $c = Config::getInstance();
 * $c->db_name  вернет "test" :)
 *
 */
class Config {

    static protected $instance = null;

    public $_p = array(
        "db_host"=>"localhost",
        "db_name"=>"test",
        "db_user"=>"root",
        "db_pass"=>"",
        //.....
    );

    static public function getInstance(){
        if(self::$instance == null){
            self::$instance = new Config();
        }
        return self::$instance;
    }

    /**
     * Меджик функция __get
     * @link http://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
     *
     * @throws Exception
     * @param  $name
     * @return array
     */
function __get($name){
    if(isset($this->_p[$name])){
        return $this->_p[$name];
    }

    throw new Exception("Ну нет такого параметра.");
}
}
